﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace TreeBuilder
{
    public class ArrowHeadWidthConverter : IValueConverter
    {
        private const double Multiplier = 5;
        private const double MinValue = 8;

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var doubleValue = (double) value;
            return Math.Max((doubleValue * Multiplier), MinValue);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var doubleValue = (double) value;
            return Math.Max((doubleValue / Multiplier), MinValue);
        }
    }
}